import { getCityInfo } from '@/api/product'
const state = {
  cityList: []
}
const mutations = {
  setCityList (state, value) {
    state.cityList = value
  }
}
const actions = {
  async getCityList ({ commit, state }) {
    if (state.cityList.length) {
      return state.cityList
    } else {
      const res = await getCityInfo()
      commit('setCityList', res)
      return state.cityList
    }
  }
}
const getters = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
